package com.es;

import com.es.entity.BankAccount;
import com.es.service.BankAccountService;
import com.es.service.impl.BankAccountServiceImpl;

import java.math.BigDecimal;

public class TestTransaction {
    static BankAccountService service = new BankAccountServiceImpl();
    //
    public static void main(String[] args) {
        BankAccount bankAccount = new BankAccount();
        //System.out.println(bankAccount.toString());
        //System.out.println(bankAccount.);

        //save();
        //trans();
        withdraw();//测脏读
    }

    private static void withdraw() {
        String cardNO ="6217002340007788999";
        BigDecimal amount = new BigDecimal("500");
        service.withdraw(cardNO, amount);
    }

    private static void trans() {
        String from ="6217002340007788999";
        String to = "6217002340007788111";

        service.trans(from, to, new BigDecimal("500"));
    }

    private static void save() {
        /*
        BankAccount bankAccount = new BankAccount();
        bankAccount.setName("李阳");
        //bankAccount.getBalance();
        bankAccount.setIdCard("370112200002012345");
        bankAccount.setCardNo("6217002340007788999");
        service.save(bankAccount);

         */
        BankAccount bankAccount1 = new BankAccount();
        bankAccount1.setName("龚明");
        //bankAccount.getBalance();
        bankAccount1.setIdCard("370112200002012385");
        bankAccount1.setCardNo("6217002340007788111");
        service.save(bankAccount1);

    }


}
